def getMenuOption(debug = False):
    if debug:
        print "getMenuOption Function"
    validInput = False
    while not validInput:
        option = raw_input("> ")
        if option == "1":
            validInput = True
        elif option == "2":
            validInput = True
        elif option == "3":
            validInput = True 
        elif (option.lower() == "exit" or
              option.lower() == "e" or
              option.lower() == "x" or
              option.lower() == "quit" or
              option.lower() == "q"):
                  validInput = True
                  option = "exit"
        else:
            print "Please type one of the available options"
    return option
        
def getWord(prompt, debug = False):
    if debug:
        print "getWord Function", prompt
    validInput = False
    while not validInput:
        option = raw_input(prompt)  
        validInput = True
        if option == "":
            print "Please type a word"
            validInput = False
        elif isSwear(option, debug):
            print "Say that again and I'll cut you :D"
            validInput = False
        elif isAfroMan(prompt, debug=False):
            print "likes tall cans!"
            validInput = True
    return option

def getWord2(prompt, debug = False):
    if debug:
        print "getWord Function", prompt
    validInput = False
    while not validInput:
        option = raw_input(prompt)  
        validInput = True
        if option == "":
            print "Please type a word"
            validInput = False
        elif isSwear(option, debug):
            print "Bad children will be punished :D"
            validInput = False
    return option

def getWord3(prompt, debug = False):
    if debug:
        print "getWord Function", prompt
    validInput = False
    while not validInput:
        option = raw_input(prompt)  
        validInput = True
        if option == "":
            print "Please type a word"
            validInput = False
        elif isSwear(option, debug):
            print "Say it again. I dare you... :D"
            validInput = False
    return option

def getWord4(prompt, debug = False):
    if debug:
        print "getWord Function", prompt
    validInput = False
    while not validInput:
        option = raw_input(prompt)  
        validInput = True
        if option == "":
            print "Please type a word"
            validInput = False
        elif isSwear(option, debug):
            print "You'll pay for your sins, belligerant! Now enter and appropriate phrase :D"
            validInput = False
    return option


def getNumber(prompt, debug = False):
    if debug:
        print "getWord Function", prompt
    validInput = False
    numbers = "0123456789."
    while not validInput:
        option = raw_input(prompt)  
        validInput = True
        for character in option:
            if not(character in numbers):
                validInput = False
        if not validInput:
            print "Type only digits!"
    return option
    
def getCreature(prompt, debug=False):
    if debug:
        print "getCreature Function", prompt
    validInput = False
    while not validInput:
        option = raw_input(prompt)  
        validInput = True
        if option == "":
            print "Please type a word"
            validInput = False
        elif isSwear(option, debug):
            print "Enter valid input. Bad children will be punished :D"
            validInput = False
        elif isCthulu(option, debug):
            print "~~~Ph'nglui mglw'nafh Cthulu R'lyeh wgah'nagl fhtagn!~~~"
            validInput = False
    return option

        
def isSwear(word, debug = False):
    if debug:
        print "isSwear Function", word
    swears = ["poop",
              "doodoo head",
              "pee",
              "fuck",
              "shit",
              "cunt",
              "asshole",
              "dick"
              ]
    if word.lower() in swears:
        return True
    else:
        return False
def isCthulu(word, debug = False):
    if debug:
        print "isCthulu Function", word
    cthulu = ["cthulu",
            "r'lyeh",]
    if word.lower() in cthulu:
        return True
    else:
        return False
def isAfroMan(word, debug = False):
    if debug:
        print "isAfroMan Function", word
    afroman= ["afroman","afro man"]
    if word.lower() in afroman:
        return True
    else:
        return False                
        
        
        
        
        
        
        
        
    
